package com.hui.base;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 李昭辉
 * @Date: 2021/07/12/14:58
 * @Description: 枚举类  ，  返回结果状态码
 */
public enum StatusCode {
    SUCCESS(0, "success"), FAIL(1, "fail");

    private int status;
    private String msg;

    StatusCode(int status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("status", this.status);
        jsonObject.put("msg", this.msg);
        return jsonObject.toString();
    }
}
